<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2008 XBRL International. All Rights Reserved. -->
<?xml-stylesheet type="text/xsl" href="../stylesheets/functionDefinition.xsl"?>
<function
  xmlns="http://xbrl.org/2008/function" 
  xmlns:reg="http://xbrl.org/2008/registry" 
  xmlns:xhtml="http://www.w3.org/1999/xhtml" 
  xmlns:xfi="http://www.xbrl.org/2008/function/instance" 
  xmlns:xbrli="http://www.xbrl.org/2003/instance" 
  xmlns:xlink="http://www.w3.org/1999/xlink" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="
  http://xbrl.org/2008/registry ../schemas/registry.xsd
  http://xbrl.org/2008/function ../schemas/function.xsd
  ">

  <lastUpdated moment="2010-09-09T00:00:00" />

  <owners>
    <reg:owner id="herm">
       <reg:name>Herm Fischer</reg:name>
      <reg:affiliation>UBMatrix / Mark V Systems</reg:affiliation>
       <reg:email>fischer@markv.com</reg:email>
       <reg:assumedOwnership moment="2008-09-01T00:00:00" />
    </reg:owner>
  </owners>

  <summary>
    Returns a string containing the label that has the specified link role,
    resource role, and language.
  </summary>

  <documentation>
    Label is found by effective relationship after considering prohibition and overrides.
  </documentation>

  <signature name="xfi:concept-label">

    <input name="concept" type="xs:QName">
      <xhtml:p>
        The QName of the subject concept whose label is to be found.
      </xhtml:p>
    </input>

    <input name="linkrole" type="xs:string?">
      <xhtml:p>
        The linkrole value that specifies the network of effective
        relationships of arcs in which to find the concept's label.
        If omitted ("()" or "''") then the default link role is used. 
      </xhtml:p>
    </input>

    <input name="labelrole" type="xs:string?">
      <xhtml:p>
        The label resource role value that is to be found.  
        If omitted ("()" or "''") then the standard label is returned.
      </xhtml:p>
    </input>

    <input name="lang" type="xs:string">
      <xhtml:p>
        The language code of the label to be retrieved.
        If a label with exact match is not found, a closest-sublanguage is returned, e.g.,
        if the argument to $lang is en-UK and a label is present with en, it is returned.
      </xhtml:p>
    </input>

    <input name="xbrlinstance" type="element(xbrli:xbrl)">
      <xhtml:p>
        This parameter is optional.  If absent the target XBRL instance provides the DTS for label linkbases.
        If provided then the specified XBRL instance provides the DTS for the label linkbases.
      </xhtml:p>
    </input>

    <output type="xs:string">
      <xhtml:p>
        Returns a label (if found) or an empty string (if no label found 
        for QName given as concept, or for roles or for language code).
      </xhtml:p>
    </output>
  </signature>

<!-- deferred
  <error code="xfie:invalidSourceQName">
    <xhtml:p>
      This error MUST be thrown if the source concept QName is not in the reference
      discoverable taxonomy set.
    </xhtml:p>
  </error>
-->

  <conformanceTest xlink:type="simple" xlink:href="90503 xfi.concept-label function testcase.xml"/>

  <revisions>
    <reg:revision on="2008-12-12T00:00:00" by="herm">
      <xhtml:p>
        Created the function definition.
      </xhtml:p>
    </reg:revision>

    <reg:revision on="2009-12-12T00:00:00" by="herm">
      <xhtml:p>
        Removed reference to dynamically loaded instances from the xbrlinstance input.
      </xhtml:p>
    </reg:revision>

    <reg:revision on="2010-09-09T00:00:00" by="herm">
      <xhtml:p>
        Changed role URIs to strings for cast-less coding and to be similar to fn:QName's $paramURI, an xs:string.
        Changed role URIs to allow () or '' for default values, to have similar style
        to xfi:concept-relationships.
      </xhtml:p>
    </reg:revision>

    <reg:revision on="2010-14-09T00:00:00" by="herm">
      <xhtml:p>
        Modified language argument for compatibility with XPath fn:lang.
        (1) Changed language argument from xs:language to xs:string.
        (2) Changed description of label language matching to allow sublanguage matching as with fn:lang.
      </xhtml:p>
    </reg:revision>
  </revisions>

</function>
